﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace fenping.utils
{
    public class CmdCommand
    {
        public string Name { get; private set; }
        public List<string> paras = new List<string>();
        private Dictionary<string, string> map = new Dictionary<string, string>();

        public CmdCommand(string command)
        {
            ParseCommand(command);
        }

        private void ParseCommand(string command)
        {
            string[] split = command.Split(' ');
            Name = split[0].Trim();
            for(int i = 1; i < split.Length; i++)
            {
                string item = split[i].Trim();
                if(item.Length == 0)
                {
                    continue;
                }

                if(IsProp(item))
                {
                    string prop = item.Substring(1);
                    string value = null;
                    if (i + 1 < split.Length)
                    {
                        if (IsProp(split[i + 1])) ;
                    }
                }
            }
        }

        private bool IsProp(string item)
        {
            if (item.Length == 0)
            {
                return false;
            }
            if (item[0] == '-')
            {
                if(item.Length == 1)
                {
                    return false;
                }
                return true;
            }
            return true;
        }
    }
}
